obj-m := mainbd_buz.o
BUILD_DIR = $(PWD)/build
SRC = $(PWD)
BUILD_DIR_MAKEFILE = $(PWD)/build/Makefile
DEPLOY_PATH = $(PWD)/../../deploy
EXTRA_CFLAGS += -I$(PWD)/../../includes

default: $(BUILD_DIR_MAKEFILE)
	make -C $(KDIR) M=$(BUILD_DIR) ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- src=$(SRC) modules
	cp $(BUILD_DIR)/*.ko $(DEPLOY_PATH)

$(BUILD_DIR):
	mkdir -p "$@"

$(BUILD_DIR_MAKEFILE): $(BUILD_DIR)
	touch "$@"
clean:
	make -C $(KDIR) M=$(BUILD_DIR) src=$(SRC) clean
	rm -r $(BUILD_DIR)